import unittest
import sys
sys.path.append(sys.path[0] + "/../interpreter")
from functionBinding import functionBinding
from functionDef import functionDef
from application import application
from Return import Return
from builtin import *
from varRef import varRef
from jsobject import *
from interpreter import interpreter
from endvals import *
from objectOps import *
from sequence import *
from conditionals import *
from sequence import *
from varBinding import *
from varMut import *
from customExceptions import *
from Footle_Parser_Test import *


class TestBuiltin(unittest.TestCase):
	def testPlus(self):
		test = footleParseTester('return(1+1);',
															Return(application("+",[integer(1),integer(1)]))
														 )
		
		assert test.test(), test.getErrorStr()

#--	------------------------------------------------------------------

	def testMinusPlus(self):
		test = footleParseTester('return(3.0-(1+1.0));',
															Return(application("-",[flp(3.0),application("+",[integer(1),flp(1.0)])]))
														 )
		
		assert test.test(), test.getErrorStr()

#--	------------------------------------------------------------------
	
	def testLessThan(self):
		test = footleParseTester('return(3 < 1);',
														Return(application("<",[integer(3),integer(1)]))
														 )
		
		assert test.test(), test.getErrorStr()

#--	------------------------------------------------------------------




if __name__ == '__main__':
    unittest.main()


